﻿using DimensionsHelper.LanguageService.Syntax;

namespace DimensionsHelper.LanguageService;

/// <summary>
///     记录<see cref="Lexer" />中的Token信息
/// </summary>
public struct LexerTokenInfo()
{
    /// <summary>
    ///     Token的起始位置
    /// </summary>
    public int Start { get; set; } = 0;


    /// <summary>
    ///     Token的起始行号
    /// </summary>
    public int StartLine { get; set; } = 1;


    /// <summary>
    ///     Token的结束位置
    /// </summary>
    public int End => Start + Length;


    /// <summary>
    ///     Token的结束行号
    /// </summary>
    public int EndLine { get; set; } = 1;


    /// <summary>
    ///     Token的结束位置
    /// </summary>
    public int Length { get; set; }

    /// <summary>
    ///     Token的文本内容
    /// </summary>
    public string Text { get; set; } = string.Empty;

    /// <summary>
    ///     当前Token的<see cref="SyntaxNodeFlags" />
    /// </summary>
    public SyntaxNodeFlags Flags { get; set; } = SyntaxNodeFlags.None;
}